﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dealin.Data.Extensions
{
    /// <summary>
    /// 列架构类
    /// </summary>
    public class ColumnSchema
    {
        #region 成员
        int m_TableId = 0;
        string m_Name = "";
        string m_Description = "";
        string m_Type = "";
        bool m_IsPrimaryKey = false;
        bool m_IsIdentity = false;
        bool m_IsUnique = false;
        bool m_IsForeignKey = false;
        #endregion

        #region 构造函数
        /// <summary>
        /// 构造函数
        /// </summary>
        public ColumnSchema()
        {
        }
        #endregion

        #region 属性
        /// <summary>
        /// 获取或设置表ID
        /// </summary>
        public int TableID
        {
            get { return m_TableId; }
            set { m_TableId = value; }
        }
        /// <summary>
        /// 获取或设置列名称
        /// </summary>
        public string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }
        /// <summary>
        /// 获取或设置列值类型
        /// </summary>
        public string FactType
        {
            get { return m_Type; }
            set { m_Type = value; }
        }

        /// <summary>
        /// 描述规则以 英文逗号 分割：显示名称,是否只读 0或1,select * from table where par1=@par1 and par2=@par2 and par3 =@par3,@par1,@par2，@par3
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
        /// <summary>
        /// 获取或设置当前列是否为主键
        /// </summary>
        public bool IsPrimaryKey
        {
            get { return m_IsPrimaryKey; }
            set { m_IsPrimaryKey = value; }
        }
        /// <summary>
        /// 获取或设置当前列是否为外键
        /// </summary>
        public bool IsForeignKey
        {
            get
            {
                return m_IsForeignKey;
            }
            set
            {
                m_IsForeignKey = value;
            }
        }
        /// <summary>
        /// 外键表主键
        /// </summary>
        public string FKTableKeyID
        {
            get;
            set;
        }
        /// <summary>
        /// 外键表
        /// </summary>
        public string FKTable
        {
            get;
            set;
        }
        /// <summary>
        /// 获取或设置当前列是否为标示
        /// </summary>
        public bool IsIdentity
        {
            get { return m_IsIdentity; }
            set { m_IsIdentity = value; }
        }
        /// <summary>
        /// 获取或设置当前列是否为唯一建
        /// </summary>
        public bool IsUnique
        {
            get { return m_IsUnique; }
            set { m_IsUnique = value; }
        }
        #endregion
    }
}
